#ifndef SYNC_QUEUE
#define SYNC_QUEUE
template <class T>
class SyncQueue
{
public:
	SyncQueue<T>()
	{
		mutex = new wxMutex();		
		full = new wxSemaphore();
	}
	~SyncQueue<T>()
	{
		delete mutex;	
		delete full;
	}
	void Enqueue(T v)
	{		
		mutex->Lock();
		queue.push(v);
		mutex->Unlock();
		full->Post();
	}
	T Dequeue()
	{
		T ret;
		full->Wait();
		mutex->Lock();
		ret = queue.front();
		queue.pop();
		mutex->Unlock();		
		return ret;
	}
private:
	wxMutex *mutex;
	wxSemaphore *full;	
	std::queue<T> queue;
};
#endif